package be.ipl.finito.util;

public class GrilleUtil {
	public static final int[][] DEFAULT_GRILLE = {{1,2,3,3,4,4},{5,5,6,6,7,7},{8,8,9,9,10,10},{11,11,12,12,13,13},{14,14,15,15,16,16},{17,17,18,18,19,20}} ;
	
	public static int getIndexY (int index) {
		return (int) (index / 6) ; 
	}
	
	public static int getIndexX (int index) {
		return index % 6 ;
	}
	
	public static int getCaseNumber(int index) {
		return DEFAULT_GRILLE[getIndexY(index-1)][getIndexX(index-1)] ;
	}
	
	public static int getIndexDuNumeroGauche(int valeurCase){
		if(valeurCase == 1)
			return 1;
		if(valeurCase == 2)
			return 2;
		if(valeurCase == 19)
			return 35;
		if(valeurCase == 20)
			return 36;
		return (valeurCase*2)-4;
	}
}
